UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KHFiwWa6BhG+ILZa41ODhzud0nWhT1rkXk3zinjXjIg='
WHERE
key_id = '088c0bf0965a6e4cb80a6e7d55368ada2af3e2453cfc4b036081efee8ff05747'
AND (
token = 'KHFiwWa6BhG+ILZa41ODhzud0nWhT1rkXk3zinjXjIg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)