UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '84EKab6wgL6kFKbFNtNcFe8oRvT8A+TJO71/r479yoU='
WHERE
key_id = '27a243f93ba7119e79bd6db9c85766a0fafe66d2c8971d08619f76adf2280047'
AND (
token = '84EKab6wgL6kFKbFNtNcFe8oRvT8A+TJO71/r479yoU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)