UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hd7Dlo7+QppfOPWJW3OEC2KCI9afxcAsdo73WxK9Nr4='
WHERE
key_id = '04ffb83cdefdf357e6d7f81413506bbc13b150e88ebcac9edf3743fbabc48d80'
AND (
token = 'Hd7Dlo7+QppfOPWJW3OEC2KCI9afxcAsdo73WxK9Nr4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)