UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mmBlhV20FZtM3yb1zTI8OSpcnYeExLL8YkY+/161xk4='
WHERE
key_id = '0a22ba3891cbe001d4ea1cc1de5288c2c4ae45d832b632a83ad3c7307b706865'
AND (
token = 'mmBlhV20FZtM3yb1zTI8OSpcnYeExLL8YkY+/161xk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)