UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '64N5e3IPEr515zKMJpPBvlMPWzIY+xRudm0c6xGgOdo=' 
WHERE 
  key_id = '6fdb265e04ec7698b5960966fe401a37b96b1315320722b979c5db6ea0eee816' 
  AND (
    token = '64N5e3IPEr515zKMJpPBvlMPWzIY+xRudm0c6xGgOdo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028