UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YJAWUfgQqRh662R7ePpaxV3JC8gXmPvnTYPMgASOPTs='
WHERE
key_id = 'e4ded35340e228e1ca2397f098c7298ccfe08dadef898480dcc35a2aba1dc35c'
AND (
token = 'YJAWUfgQqRh662R7ePpaxV3JC8gXmPvnTYPMgASOPTs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)