UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tYXINmaGN89ZuxEBQpF/ytJzeEehXU4xRklDdLTNcaw='
WHERE
key_id = '14e361f5330115aca0cccce5e9f72ee12cf88504059d248baab8a74f157b011f'
AND (
token = 'tYXINmaGN89ZuxEBQpF/ytJzeEehXU4xRklDdLTNcaw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)