UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TRPqNcXGP6bCBkgBY3PNlg/L1HkD6J/StpYlni1bsOE='
WHERE
key_id = 'd7b6b63417a08a193607cd891eaa9ae01b778f1a59f1ecfa7929aac9ac42c047'
AND (
token = 'TRPqNcXGP6bCBkgBY3PNlg/L1HkD6J/StpYlni1bsOE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)