UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fiQaUga1jI7W7sk1i13KZMEupwNFaAmgMn1rcjDfVMs='
WHERE
key_id = '308f87847f9c61534ae67abb55a38301cf840f8a9c5fa74f94df860ecaba5d3e'
AND (
token = 'fiQaUga1jI7W7sk1i13KZMEupwNFaAmgMn1rcjDfVMs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)