UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PAw7M0+OjRZ5F0JXp/qCexmfOBe3lgENPebPtLhtNO8='
WHERE
key_id = '55d6066159dda849b09a746bca2c8a1287a639feb662a0f8fdba6fa89a0637b0'
AND (
token = 'PAw7M0+OjRZ5F0JXp/qCexmfOBe3lgENPebPtLhtNO8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)