UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0qnFwYe8EN7lJmnjipjMpXUEu3yV1Zaq6aXBcH25Zqw='
WHERE
key_id = '0b5034b5f5e5ff91947b1f8f4d4264c83a2439684f6757825df1293a6fd13ff6'
AND (
token = '0qnFwYe8EN7lJmnjipjMpXUEu3yV1Zaq6aXBcH25Zqw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)