UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sj0tmn625UxNogO+LCm7dQq+PhnXth9jjSYL+jaQTZk=' 
WHERE 
  key_id = '4a802fe2eb04544311708aba1f785344dcb1a409f1769be1b96c049ad7892fdf' 
  AND (
    token = 'sj0tmn625UxNogO+LCm7dQq+PhnXth9jjSYL+jaQTZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049