UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S1GvxQ0UQzxg2zEP16IbmFvWB4lWFW8oXSkQqKAjh6o='
WHERE
key_id = 'e03989a8d43e955a01df9a2157029bc8e4f73349a4fdd2205c3cb7ae3d45e336'
AND (
token = 'S1GvxQ0UQzxg2zEP16IbmFvWB4lWFW8oXSkQqKAjh6o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)