UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ri7VsJQxF8Ih78bsKqAgAMCDnr+aRHz+5+BnqFCd3Ow='
WHERE
key_id = 'c4df8be6b4991e5d8eaa68c7fd01787a4cee11812b5477e08572d61711ee0cdb'
AND (
token = 'ri7VsJQxF8Ih78bsKqAgAMCDnr+aRHz+5+BnqFCd3Ow='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)