UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XgDpksFVuJAOOCBYd5vGZC5DdJ/u0ZtUq5QLa/N3b/E='
WHERE
key_id = 'af1330bac686ca15b705687102cc8b0022abf88d677e193709c626e645ff70e0'
AND (
token = 'XgDpksFVuJAOOCBYd5vGZC5DdJ/u0ZtUq5QLa/N3b/E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)