UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dunf9plmxGUfBD5JmlDVnT3/+2dDiTo11dPsuA7LrH8='
WHERE
key_id = 'acbe5f34cdd7ee1d8d1656f5dca1cdc5db88f26fb8c6234fe063b83232f1ca00'
AND (
token = 'dunf9plmxGUfBD5JmlDVnT3/+2dDiTo11dPsuA7LrH8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)