UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f6+4UgmoXZztejLrs2v6FWYybCbHCTnNu18n3RARtgk=' 
WHERE 
  key_id = '4c20c1f2a34ed252ea677427803b28ba9d1ec337a46915bfa655ee96a503cd92' 
  AND (
    token = 'f6+4UgmoXZztejLrs2v6FWYybCbHCTnNu18n3RARtgk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026