UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dA27/SjzYUh/3oN6Ckfn2D7fxbpjOLzENDI6Us29hPw='
WHERE
key_id = '3884570dba84a3a35780b2df23a92bc03d15b5ea51f999d2237832a73157892a'
AND (
token = 'dA27/SjzYUh/3oN6Ckfn2D7fxbpjOLzENDI6Us29hPw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)