UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KKpYAyJeEYIXMp2yyGsOGw0qClY8O5AOj3+/02/nrlo='
WHERE
key_id = 'b8e7d45e2cebe0975aecb7ebc9d2b014b9771772305e896117aeaca6adfdbafe'
AND (
token = 'KKpYAyJeEYIXMp2yyGsOGw0qClY8O5AOj3+/02/nrlo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)