UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UuMJoJ5+JEbUJxoXLDR49xEWI6Y3IYCMsfAcvsB/oN0=' 
WHERE 
  key_id = '9042c7231a0fd34d49fa04e1e18152407d666a824f45ff7da26b392d5f82cbee' 
  AND (
    token = 'UuMJoJ5+JEbUJxoXLDR49xEWI6Y3IYCMsfAcvsB/oN0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035