UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6/XjRbP9lRbwVhg0SnMxnN1wXsAwbBToFwU8ivE1+xI='
WHERE
key_id = '9b23f6ca8f3c819daae9d7f5edb480b541c13d4b15713103b33ad2a812afb765'
AND (
token = '6/XjRbP9lRbwVhg0SnMxnN1wXsAwbBToFwU8ivE1+xI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)