UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3XiO4X5ZHU871DmTwFlSfCpJuOlEKFnJMoUsozXh0g8='
WHERE
key_id = 'a1c49d0d87079f1ad4c820d16c362ecdd987f8604b4f8b958d2f7335ce33b33f'
AND (
token = '3XiO4X5ZHU871DmTwFlSfCpJuOlEKFnJMoUsozXh0g8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)