UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qc3CiOe/fm8vHupnZDNm3E+sdXXlYNgUhSgWHXrfEUg='
WHERE
key_id = 'ab8f4952528a627333bd55aff29dd625a1b666543a5f8e992e68c4e0389773aa'
AND (
token = 'qc3CiOe/fm8vHupnZDNm3E+sdXXlYNgUhSgWHXrfEUg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)