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

Query time 0.00020