UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mg7o9rjJML5tOyuAM2a9B67WXtvdpNUSDeXnUtUaqmQ=' 
WHERE 
  key_id = 'deed833c760298ddf7ce9ae776d26cf27247580481db10416ca3336e01e0664d' 
  AND (
    token = 'mg7o9rjJML5tOyuAM2a9B67WXtvdpNUSDeXnUtUaqmQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029