UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hphtw+saPr1764MRR6dlUy+stIrNxNSv0a2jCfXw+n0='
WHERE
key_id = '5590deb07fb3a1032261584410af21e9308f10974df90c07851b491723690278'
AND (
token = 'hphtw+saPr1764MRR6dlUy+stIrNxNSv0a2jCfXw+n0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)