UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N0jFrDuC5qvRg3hdi73X8n3t9ia6E6mH1w+WiN38wIY='
WHERE
key_id = '99e754a5584aa38ff8c863eefec14dc1a235c86e163552a2c7320b115721b92a'
AND (
token = 'N0jFrDuC5qvRg3hdi73X8n3t9ia6E6mH1w+WiN38wIY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)