UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hol+2p8pqYMLwbNDvoglQJ8U7TRnbSw3NvjpYtGG2cE=' 
WHERE 
  key_id = 'ce1244b6fbfa48c46e7522160ba521b130c3f27908d555df399821ed61254649' 
  AND (
    token = 'Hol+2p8pqYMLwbNDvoglQJ8U7TRnbSw3NvjpYtGG2cE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040