UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'H25iFuLY1ytMiwqEx/ElhdEQgFEy5CFLZqj88HiuirA='
WHERE
key_id = '6c4714910e73aa38db36a5c8f5666b2b50a58b792a575eed05f165364bd8bb06'
AND (
token = 'H25iFuLY1ytMiwqEx/ElhdEQgFEy5CFLZqj88HiuirA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)