UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '28KF8HfRG7jxluhi4XZWcU1fRSfVSDeq7XrRMujix+M=' 
WHERE 
  key_id = '5b4061587f888fbc01a2a68d31799df878aa55bce9cd95cbd0e69d60b3303864' 
  AND (
    token = '28KF8HfRG7jxluhi4XZWcU1fRSfVSDeq7XrRMujix+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035