UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ew+jTLV9hiBcizEgpjRo6LxA87eD8CfIPH7J569/kr0='
WHERE
key_id = '146e6e1a29076c860cbfb06769c5ae6b6b2f59ac34ccf6e60f586657d367b18e'
AND (
token = 'ew+jTLV9hiBcizEgpjRo6LxA87eD8CfIPH7J569/kr0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)