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