UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nE3ptnHnTqtfY0UyfZXSfRKUIV2sAyjj7Nddf5YxEpQ='
WHERE
key_id = '2f4dc5c4f676524ca7066a52be633492fde665c4ee18996dc65672ce959e82c0'
AND (
token = 'nE3ptnHnTqtfY0UyfZXSfRKUIV2sAyjj7Nddf5YxEpQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)