UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MIgv+HkQSl37xGymw/KQ1nqfdXPmrWtJF32YurahiLo=' 
WHERE 
  key_id = '51b8da8e0b53d14a8b160da7654c5368e901259e64edfcc0fe2ccb8288c08b03' 
  AND (
    token = 'MIgv+HkQSl37xGymw/KQ1nqfdXPmrWtJF32YurahiLo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023