UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6QNUpP9nqZ70BUD6uviUPSIIEhiRPwoEwbyC5hJMzmg='
WHERE
key_id = 'db53b6db730eddef2c66ea722318ea5e6cab31aae0ee1384479383a5b6d0edf3'
AND (
token = '6QNUpP9nqZ70BUD6uviUPSIIEhiRPwoEwbyC5hJMzmg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)