UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SDBPGDwbQAbtzkDjrMRa1qdajMOsrMLvIcEqyMO28W8=' 
WHERE 
  key_id = '9a74db43f3bb2db593a986c5173556683560e545fad3ea41776967626f0ab007' 
  AND (
    token = 'SDBPGDwbQAbtzkDjrMRa1qdajMOsrMLvIcEqyMO28W8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032