UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MJcUcasd6FcTNy16Oibj+7l4SDrah62TIYlHo7t9Sbg='
WHERE
key_id = '0c87edf3764fc4396c95e034d1da895c0a48feeafff49a768c70802e59858d9f'
AND (
token = 'MJcUcasd6FcTNy16Oibj+7l4SDrah62TIYlHo7t9Sbg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)