UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KyHrC5LWBf7xIyTyBpisBxrcdaXp+Ts1yeOzAJE0xck=' 
WHERE 
  key_id = 'ddda422fe8861b52a4ae9bae5af64de65a9821f50d29d32afe3ad1ad62dfae85' 
  AND (
    token = 'KyHrC5LWBf7xIyTyBpisBxrcdaXp+Ts1yeOzAJE0xck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036