UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'drAsI92kyLcbmbafVXVjegswQWH1p+lx7Tjy3ywrNXA='
WHERE
key_id = 'a039bf37d200b894471fb5220575a198331f5b250f398e882e85e697292264e8'
AND (
token = 'drAsI92kyLcbmbafVXVjegswQWH1p+lx7Tjy3ywrNXA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)