UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AgrlHsNOxX7NQHhNGbC1AoYgYuqEh3KIBI23D7iMMtU=' 
WHERE 
  key_id = '0e3f010d24dacee7e0df52b43b5250db6b2372701435828410c9c893be302a17' 
  AND (
    token = 'AgrlHsNOxX7NQHhNGbC1AoYgYuqEh3KIBI23D7iMMtU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056