UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cTKSE0gUi0MQ21VHbOCCa5NGqht0cs6m+hausSUafQ4='
WHERE
key_id = 'a729cedef9dea29d50f0716274fcfb08515d045561f779160b9a8ee6882fb966'
AND (
token = 'cTKSE0gUi0MQ21VHbOCCa5NGqht0cs6m+hausSUafQ4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)