UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xcJjhkO0+AansZNf1oBGzqX9BkCOl9DtC7EThKlHuIg='
WHERE
key_id = 'f875a51a3599c9a75582ea763026a1acfd9c551a1aceabf97a99f3846ae02bd4'
AND (
token = 'xcJjhkO0+AansZNf1oBGzqX9BkCOl9DtC7EThKlHuIg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)