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