UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GD3jTmGXVgPV7ruF6fX4eiUw1EpwYZFGkVnPmGaFExg='
WHERE
key_id = '7ec93e8f9f3fdf8c219179707b69f7ed87a62df9497fd3307c8077b789ea4af4'
AND (
token = 'GD3jTmGXVgPV7ruF6fX4eiUw1EpwYZFGkVnPmGaFExg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)