UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CnqqYyQ6ZjqUlk8geS1j9l0MxOGnruEuuJiBpCFTBLk='
WHERE
key_id = '7c9dff7a32171a62c3c660e2518f37e2c02cd684fc2e4af3ae9bc5a2f3c97f6f'
AND (
token = 'CnqqYyQ6ZjqUlk8geS1j9l0MxOGnruEuuJiBpCFTBLk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)